var items = document.getElementsByClassName('item');
var index = 0;
var goNextBtn = document.getElementById('geNext');
var goPreBtn = document.getElementById('goPre');

var clearActive = function () {
    for (var i=0;i<items.length;i++){
        items[i].className='item';
    }
}

var goIndex = function () {
    clearActive();
    items[index].className = 'item active';
}

var goPre = function () {
    if (index == 0) {
        index = 5;
    }
    else
    index -- ;
    goIndex();
}

var goNext = function () {
    if (index == 4) {
        index == -1 ;
    }
    else
    index ++ ;
    goIndex();
}

goPreBtn.addEventListener('click',function(){
    goPre();
})
goNextBtn.addEventListener('click',function(){
    goNext();
})